<div class="sidebar w-full md:w-1/3<%= ' hide-ios' if turbolinks_app? && action_name != 'show' %> shrink-0" id='sidebar'>
  <div class="mb-4 card profile">
    <div class="card-body">
      <div class="media">
        <div class="mr-3 avatar media-left">
          <div class='image'><%= user_avatar_tag(@user, :lg, link: false) %></div>
        </div>
        <div class="media-body">
          <div class="flex items-center item name-box md:justify-between">
            <div>
              <% if @user.name.present? %>
                <div class="fullname"><%= @user.name %></div>
              <% end %>
              <div class="login">@<%= @user.login %></div>
            </div>
            <div class="user-badge">
              <div class="level"><%= user_level_tag(@user) %></div>
              <% if current_user&.admin? %>
                <div class="opts">
                  <%= link_to icon_tag("user-cog"), edit_admin_user_path(@user.id) %>
                </div>
              <% end %>
            </div>
          </div>
          <div class="flex item number align-items-center">
            <%= t("users.number_of_user", no: @user.id)%> / <span title="<%= t("users.join_time") %>"><%= @user.created_at.to_date %></span>
            <% if @user.online? %>
            <div class="w-2 h-2 ml-2 bg-green-600 rounded" title="<%= t('common.online')%>"></div>
            <% end %>
          </div>
        </div>
      </div>
      <hr>
      <div class="user-items">
        <% if @user.email.present? && @user.email_public %>
          <div class="item"><a href="mailto: <%= @user.email %>"><%= icon_tag("email") %> <%= @user.email %></a></div>
        <% end %>
        <% if !@user.company.blank? %>
          <div class="item company">
            <%= icon_tag("company") %> <%= @user.company %>
          </div>
        <% end %>
        <% if @user.location.present? %>
          <div class="item location" title="Location">
            <%= icon_tag("location") %> <%= location_name_tag(@user.location) %>
          </div>
        <% end %>
        <div class="item counts">
          <%= t("users.topics_count_html", count: @user.topics_count) %>
          <span class="divider">/</span>
          <%= t("users.replies_count_html", count: @user.replies_count) %>
        </div>
        <div class="item social">
          <% if !@user.twitter.blank? %>
            <%= link_to icon_bold_tag("twitter"), @user.twitter_url, class: "twitter", rel: "nofollow" %>
          <% end %>
          <% if Setting.has_module? :github %>
            <% if !@user.github.blank? %>
              <%= link_to(icon_bold_tag("github"), @user.github_url, target: '_blank', rel: 'nofollow') %>
            <% end %>
          <% end %>
          <% if !@user.website.blank? %>
            <%= link_to(icon_tag("globe"), @user.website_url, target: '_blank', rel: 'nofollow') %>
          <% end %>
          <%= link_to(icon_tag("rss"), feed_user_url(@user), target: '_blank', rel: 'nofollow') %>
        </div>
      </div>
      <div class="flex items-center follow-info md:justify-between hide-ios">
        <div class="followers" data-login="<%= @user.login %>">
          <%= link_to @user.followers_count, followers_user_path(@user), class: "counter" %>
          <%= link_to t("users.menu.followers"), followers_user_path(@user), class: "text" %>
        </div>
        <div class="following">
          <%= link_to @user.following_count, following_user_path(@user), class: "counter" %>
          <%= link_to t("users.menu.following"), following_user_path(@user), class: "text" %>
        </div>
        <div class="stars">
          <%= link_to @user.favorites_count, favorites_user_path(@user), class: "counter" %>
          <%= link_to t("users.menu.favorites"), favorites_user_path(@user), class: "text" %>
        </div>
      </div>
      <% if !owner? @user %>
        <div class="buttons row">
          <div class="col-sm-6">
            <%= follow_user_tag(@user) %>
          </div>
          <div class="col-sm-6">
            <%= block_user_tag(@user) %>
          </div>
        </div>
      <% end %>
      <% if !@user.tagline.blank? %>
        <div class="tagline row">
          <%= @user.tagline %>
        </div>
      <% end %>
      <div class="buttons">
        <%= reward_user_tag(@user, class: "btn btn-block btn-secondary") %>
      </div>
    </div>
  </div>
  <% if Setting.has_module?(:team) %>
    <% @user_teams = @user.teams %>
    <% if !@user_teams.blank? %>
      <div class="mb-4 card user-teams">
        <div class="card-body">
          <% @user_teams.each do |team| %>
            <%= user_avatar_tag(team, :md) %>
          <% end %>
        </div>
      </div>
    <% end %>
  <% end %>
  <%= render '/users/repos', user: @user %>
</div>
